package tsj.ai.alibaba.data.analysis.dto.schema;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import lombok.NoArgsConstructor;
import tsj.ai.alibaba.data.analysis.common.util.JsonUtil;

import java.util.List;
import java.util.Map;

/**
 * @author taoshujian
 * @version 1.0
 * @since 2025-11-14 11:42:53
 */
@Data
@NoArgsConstructor
public class ColumnDTO {
    private String name;

    private String description;

    private int enumeration;

    private String range;

    private String type;

    private List<String> samples;

    private List<String> data;

    private Map<String, String> mapping;

    @Override
    public String toString() {
        ObjectMapper objectMapper = JsonUtil.getObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        }
        catch (JsonProcessingException e) {
            throw new RuntimeException("Failed to convert object to JSON string", e);
        }
    }
}
